package com.mall.shopping.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.shopping.constants.ShoppingRetCode;
import com.mall.shopping.model.ShoppingGoodsBo;
import lombok.Data;

/**
 * @description: TODO
 * @author: jiaolei
 * @date: 2021/12/12 20:16
 */
@Data
public class GoodsRequest extends AbstractRequest {
    ShoppingGoodsBo shoppingGoodsBo;
    @Override
    public void requestCheck() {
        if(shoppingGoodsBo.getPriceGt()!=null&&
        shoppingGoodsBo.getPriceLte()!=null&&
                shoppingGoodsBo.getPriceGt()>shoppingGoodsBo.getPriceLte()){
            throw new ValidateException(ShoppingRetCode.PARAMETER_VALIDATION_FAILED.getCode(),
                    ShoppingRetCode.PARAMETER_VALIDATION_FAILED.getMessage());
        }
    }
}
